package com.db.yupao.once;

import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelReader;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.read.listener.PageReadListener;
import com.alibaba.excel.read.listener.ReadListener;
import com.alibaba.excel.read.metadata.ReadSheet;
import com.alibaba.excel.util.ListUtils;

import java.io.File;
import java.util.List;

/**
 * @ProjectName: yupao-back
 * @ClassName: ImportExcel
 * @Author: LYP
 * @Version: 1.0.0
 * @CreateTime:2025/2/12 17:58
 * @Description:
 */

public class ImportExcel {


    public static void main(String[] args) {
        String fileName = "D:\\Python\\selenium自动化\\output.xlsx";
        // 这里默认每次会读取100条数据 然后返回过来 直接调用使用数据就行
        // 具体需要返回多少行可以在`PageReadListener`的构造函数设置
        EasyExcel.read(fileName, UserInfo.class, new PageReadListener<UserInfo>(dataList -> {
            for (UserInfo UserInfo : dataList) {
                System.out.println(UserInfo);
            }
        })).sheet().doRead();
    }
    }
